import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;

public class Test {





    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
         // 注意 while 处理多个 case
        String str = in.nextLine();
        if(str.isEmpty()) {
            System.out.print("0");
        }
        Stack<Character> stack = new Stack<>();
        for (int i = 0; i < str.length(); i++) {
            if(stack.empty()) {
                stack.add(str.charAt(i));
                continue;
            }
            if (stack.peek() == str.charAt(i)) {
                stack.pop();
            }else {
                stack.add(str.charAt(i));
            }
        }
        if (stack.empty()) {
            System.out.print("0");
        }
        Stack<Character> stack1 = new Stack<>();
        while (!stack.empty()) {
            stack1.add(stack.pop());
        }
        while (!stack1.empty()) {
            System.out.print(stack1.pop());
        }

    }



    public boolean isSubsequence (String S, String T) {
        // write code here
        if (S.length() == 1 && T.length() == 1) {
            return S.equals(T);
        }
        Set<Character> set1 = new HashSet<>();//S
        for (int i = 0; i < S.length(); i++) {
            set1.add(S.charAt(i));
        }
        Set<Character> set2 = new HashSet<>();//T
        for (int i = 0; i < T.length(); i++) {
            set2.add(T.charAt(i));
        }
        for (int i = 0; i < T.length(); i++) {
            if(!set1.contains(T.charAt(i))) {
                set2.remove(T.charAt(i));
            }
        }

        if(set1.equals(set2)) {
            return true;
        }

        return false;
    }
}
